﻿#include "FITKAbaMaterialElastic.h"


Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialBehaviorType Interface::FITKAbaMaterialElastic::getMaterialBehaviorType()
{
    return Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialBehaviorType::Elastic;
}

Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialElasticType Interface::FITKAbaMaterialElastic::getMaterialElasticType() const
{
    return m_elasticType;
}

void Interface::FITKAbaMaterialElastic::setMaterialElasticType(FITKAbaMaterialBehaviorEnum::FITKAbaMaterialElasticType type)
{
    m_elasticType = type;
}

bool Interface::FITKAbaMaterialElastic::getUseTemperatureDependentData() const
{
    return m_useTemperatureDependentData;
}

void Interface::FITKAbaMaterialElastic::setUseTemperatureDependentData(bool stat)
{
    m_useTemperatureDependentData = stat;
    if (!m_useTemperatureDependentData)
    {
        m_isotropicDatas.resize(1);
        m_engineeringConstantsDatas.resize(1);
    }
}

bool Interface::FITKAbaMaterialElastic::getNoCompression() const
{
    return m_noCompression;
}

void Interface::FITKAbaMaterialElastic::setNoCompression(bool stat)
{
    m_noCompression = stat;
}

bool Interface::FITKAbaMaterialElastic::getNoTension() const
{
    return m_noTension;
}

void Interface::FITKAbaMaterialElastic::setNoTension(bool stat)
{
    m_noTension = stat;
}

int Interface::FITKAbaMaterialElastic::getIsotropicNumberOfRows() const
{
    return m_isotropicDatas.size();
}

void Interface::FITKAbaMaterialElastic::setIsotropicNumberOfRows(int rows)
{
    if (rows <= 1)
        return;
    if (!m_useTemperatureDependentData)
        return;
    m_isotropicDatas.resize(rows);
}

void Interface::FITKAbaMaterialElastic::insertIsotropicRow(int index)
{
    if (!m_useTemperatureDependentData)
        return;
    m_isotropicDatas.insert(index, ElasticIsoTropicData());
}

void Interface::FITKAbaMaterialElastic::removeIsoTropicRow(int index)
{
    if (!m_useTemperatureDependentData)
        return;
    if (m_isotropicDatas.size() == 1)
        return;
    if (index >= 0 && index < m_isotropicDatas.size())
        m_isotropicDatas.removeAt(index);
}

double Interface::FITKAbaMaterialElastic::getIsotropicTemperature(int index) const
{
    if (index >=0 && index < m_isotropicDatas.size())
        return m_isotropicDatas.at(index).getTemperature();
    return 0.0;
}

void Interface::FITKAbaMaterialElastic::setIsotropicTemperature(double temperature, int index)
{
    if (index >=0 && index < m_isotropicDatas.size())
        m_isotropicDatas[index].setTemperature(temperature);
}

double Interface::FITKAbaMaterialElastic::getIsotropicYoungsModulus(int index) const
{
    if (index >=0 && index < m_isotropicDatas.size())
        return m_isotropicDatas[index].getYoungsModulus();
    return 0.0;
}

void Interface::FITKAbaMaterialElastic::setIsotropicYoungsModulus(double moudulus, int index)
{
    if (index >=0 && index < m_isotropicDatas.size())
        m_isotropicDatas[index].setYoungsModulus(moudulus);
}

double Interface::FITKAbaMaterialElastic::getIsotropicPoisssonRatio(int index) const
{
    if (index >=0 && index < m_isotropicDatas.size())
        return m_isotropicDatas[index].getPoissonRatio();
    return 0.0;
}

void Interface::FITKAbaMaterialElastic::setIsotropicPoissonRatio(double poisson, int index)
{
    if (index >=0 && index < m_isotropicDatas.size())
        m_isotropicDatas[index].setPoissonRatio(poisson);
}

int Interface::FITKAbaMaterialElastic::getEngineeringConstantsNumberOfRows() const
{
    return m_engineeringConstantsDatas.size();
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsNumberOfRows(int rows)
{
    if (rows <= 1)
        return;
    if (!m_useTemperatureDependentData)
        return;
    m_engineeringConstantsDatas.resize(rows);
}

void Interface::FITKAbaMaterialElastic::insertEngineeringConstantsRow(int index)
{
    if (!m_useTemperatureDependentData)
        return;
    m_engineeringConstantsDatas.insert(index, EngineeringConstantsData());
}

void Interface::FITKAbaMaterialElastic::removeEngineeringConstantsRow(int index)
{
    if (!m_useTemperatureDependentData)
        return;
    if (m_engineeringConstantsDatas.size() == 1)
        return;
    if (index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas.removeAt(index);
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsE1(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getE1();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsE2(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getE2();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsE3(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getE3();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsNu12(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getNu12();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsNu13(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getNu13();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsNu23(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getNu23();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsG12(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getG12();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsG13(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getG13();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsG23(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getG23();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getEngineeringConstantsTemperature(int index) const
{
    if (index >=0 && index < m_engineeringConstantsDatas.size())
        return m_engineeringConstantsDatas[index].getTemperature();
    return 0.0;
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsE1(double value, int index )
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setE1(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsE2(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setE2(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsE3(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setE3(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsNu12(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setNu12(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsNu13(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setNu13(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsNu23(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setNu23(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsG12(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setG12(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsG13(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setG13(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsG23(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setG23(value);
}

void Interface::FITKAbaMaterialElastic::setEngineeringConstantsTemperature(double value, int index)
{
    if ( index >= 0 && index < m_engineeringConstantsDatas.size())
        m_engineeringConstantsDatas[index].setTemperature(value);
}

int Interface::FITKAbaMaterialElastic::getLaminaNumberOfRows() const
{
    return m_laminaDatas.size();
}

void Interface::FITKAbaMaterialElastic::setLaminaNumberOfRows(int rows)
{
    if (!m_useTemperatureDependentData)
        return;
    if (rows <=1)
        return;
    m_laminaDatas.resize(rows);
}

void Interface::FITKAbaMaterialElastic::insertLaminaRow(int index)
{
    if (!m_useTemperatureDependentData)
        return;
    m_laminaDatas.insert(index, ElasticLaminaData());
}

void Interface::FITKAbaMaterialElastic::removeLaminaRow(int index)
{
    if (m_laminaDatas.size() == 1)
        return;
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas.removeAt(index);
}

double Interface::FITKAbaMaterialElastic::getLaminaE1(int index) const
{
    if (index >= 0 && index < m_laminaDatas.size())
        return m_laminaDatas[index].getE1();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getLaminaE2(int index) const
{
    if (index >= 0 && index < m_laminaDatas.size())
        return m_laminaDatas[index].getE2();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getLaminaNu12(int index) const
{
    if (index >= 0 && index < m_laminaDatas.size())
        return m_laminaDatas[index].getNu12();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getLaminaG12(int index) const
{
    if (index >= 0 && index < m_laminaDatas.size())
        return m_laminaDatas[index].getG12();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getLaminaG13(int index) const
{
    if (index >= 0 && index < m_laminaDatas.size())
        return m_laminaDatas[index].getG13();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getLaminaG23(int index) const
{
    if (index >= 0 && index < m_laminaDatas.size())
        return m_laminaDatas[index].getG23();
    return 0.0;
}

double Interface::FITKAbaMaterialElastic::getLaminaTemperature(int index) const
{
    if (index >= 0 && index < m_laminaDatas.size())
        return m_laminaDatas[index].getTemperature();
    return 0.0;
}

void Interface::FITKAbaMaterialElastic::setLaminaE1(double value, int index)
{
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas[index].setE1(value);
}

void Interface::FITKAbaMaterialElastic::setLaminaE2(double value, int index)
{
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas[index].setE2(value);
}

void Interface::FITKAbaMaterialElastic::setLaminaNu12(double value, int index)
{
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas[index].setNu12(value);
}

void Interface::FITKAbaMaterialElastic::setLaminaG12(double value, int index)
{
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas[index].setG12(value);
}

void Interface::FITKAbaMaterialElastic::setLaminaG13(double value, int index)
{
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas[index].setG13(value);
}

void Interface::FITKAbaMaterialElastic::setLaminaG23(double value, int index)
{
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas[index].setG23(value);
}

void Interface::FITKAbaMaterialElastic::setTemperature(double value, int index)
{
    if (index >= 0 && index < m_laminaDatas.size())
        m_laminaDatas[index].setTemperature(value);
}

